import { _decorator, Button, Component, ForwardFlow, Label, Node, Sprite } from 'cc';
import { UIComponent } from '../../../../Framework/Scripts/Managers/UIComponent';
const { ccclass, property } = _decorator;

@ccclass('GameHD4_Ctr')
export class GameHD4_Ctr extends UIComponent {
    spIocn: Sprite;
    labType: Label;
    labDes: Label;
    isClick: Boolean;
    protected onLoad(): void {
        this.InitUI();
    }

    start() {
        this.InitData();
    }

    protected onDestroy(): void {
        this.unRegisterEvent();
    }

    private InitUI(){
        this.registerEvent();

        this.spIocn = this.ViewComponent('root/spIcon',Sprite);
        this.labType = this.ViewComponent('root/spTitlebg/Label',Label);
        this.labDes = this.ViewComponent('root/Node/Label',Label);

        this.AddButtonListener('root/btnClose',this,this.OnBtnCloseClick);
        this.AddButtonListener('root/btnGet',this, this.onBtnGet);
    }

    private InitData(){
        this.isClick =  true;
    }

    private registerEvent(){
        //  globalThis.gameMgr._eventTarget.on(EventMsgKes.loading,this.onLoadingPro,this);
    }

    private unRegisterEvent(){
        //  globalThis.gameMgr._eventTarget.off(EventMsgKes.loading,this.onLoadingPro,this);
    }

    private onBtnGet(btn: Button){
        if(this.isClick == false){
            return;
        }
        this.isClick = false;
        globalThis.gameMgr._GameHallMsg.GetHD_SurpriseChestReq();
    }
}


